package utils;

import java.util.List;

public class Calculator {

	private static double floor(final double a, final int n) {
		double p = Math.pow(10.0, n);
		return Math.floor((a * p) + 0.5) / p;
	}
	
	private static float somme(List<Double> value){
		float somme = 0;
		for(int i = 0; i < value.size(); i++){
			somme += value.get(i);
		}
		return somme;		
	}
	
	public static double moyenne(List<Double> value){		
		return value.size() > 0 ? floor(somme(value)/value.size(),2) : 0.0;		
	}
	
}
